<ui:composition xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"  
	xmlns:f="http://java.sun.com/jsf/core"
	template="template/template.xhtml">
	<ui:define name="title">
		<h:outputText value="#{msgs.hierarchyVisualization}"/>
	</ui:define>
	<ui:define name="bodyInclude">
		<ui:include src="include/menu.xhtml" />
		<p:layout fullPage="false" styleClass="layout">
			<p:layoutUnit closable="false" collapsed="false" collapsible="true" header="#{msgs.hierarchy}" position="left" resizable="false" scrollable="true" styleClass="layoutUnit" width="250">
				<h:form id="hierarchyTreeForm">
					<p:tree expanded="true" id="hierarchyTree" nodeSelectListener="#{hierarchyVisualisationController.onNodeSelectEvent}" selection="#{hierarchyVisualisationController.selectedNode}" selectionMode="single" update="visualizationUnit" value="#{hierarchyVisualisationController.root}" var="node">
						<p:treeNode>
							<h:outputText value="#{node}" />
						</p:treeNode>
						<p:treeNode type="#{hierarchyVisualisationController.nodeTypeFailureVariant}">
							<h:outputText escape="false" value="#{node.variantId} - #{node.escapedLabel}" styleClass="treeIcon treeIconFailureVariant"/>
						</p:treeNode>
						<p:treeNode type="#{hierarchyVisualisationController.nodeTypeItem}">
							<h:outputText value="#{node.label}" styleClass="treeIcon treeIconItem"/>
						</p:treeNode>
						<p:treeNode type="#{hierarchyVisualisationController.nodeTypeMap}">
							<h:outputText value="#{node}" styleClass="treeIcon treeIconMap"/>
						</p:treeNode>
						<p:treeNode type="#{hierarchyVisualisationController.nodeTypeProcedural}"> 
							<h:outputText value="#{node.label}" styleClass="treeIcon treeIconProcedural"/>
						</p:treeNode>
						<p:treeNode type="#{hierarchyVisualisationController.nodeTypeSuccessVariant}"> 
							<h:outputText escape="false" value="#{node.variantId} - #{node.escapedLabel}" styleClass="treeIcon treeIconSuccessVariant"/>
						</p:treeNode>
					</p:tree>
				</h:form>
			</p:layoutUnit>
			<p:layoutUnit closable="false" collapsible="false" header="#{msgs.hierarchy} - #{hierarchyVisualisationController.currentHierarchy.highLevelGoal} (#{msgs.responsable}: #{hierarchyVisualisationController.currentHierarchy.user.lastName} #{hierarchyVisualisationController.currentHierarchy.user.name})" id="visualizationUnit" position="center" resizable="false" scrollable="true" styleClass="layoutUnit">
				<p:outputPanel layout="block" rendered="#{not(not sessionController.sessionUser.responsable and not sessionController.sessionUser.administrator and null != hierarchyVisualisationController.selectedNode and ((hierarchyVisualisationController.selectedNodeMap and not hierarchyVisualisationController.actionExistingFromCurrentMap) or (hierarchyVisualisationController.selectedNodeProceduralDiagram and not hierarchyVisualisationController.elementExistingFromCurrentDiagram)))}" styleClass="container center">
				
					<!-- No selected node -->
					<h:outputText rendered="#{null == hierarchyVisualisationController.selectedNode}" value="#{msgs.pleaseSelectANodeInTheHierarchy}"/>
					
					<!-- Map to create -->
					<h:form id="errorForm" rendered="#{null != hierarchyVisualisationController.selectedNode and hierarchyVisualisationController.selectedNodeMap and not hierarchyVisualisationController.actionExistingFromCurrentMap}" styleClass="marginLogin">
						<p:outputPanel layout="block" rendered="#{hierarchyVisualisationController.errorIntentionOrSectionNumber or hierarchyVisualisationController.errorIsolatedExclusiveSection or hierarchyVisualisationController.errorIsolatedIntention or hierarchyVisualisationController.errorMaxIterationNumberMissing or hierarchyVisualisationController.errorStartOrStopIntentionMissing or hierarchyVisualisationController.errorStartIntention or hierarchyVisualisationController.errorStopIntention or hierarchyVisualisationController.errorMissingIntention}" styleClass="errorMessage">
							<h:outputText rendered="#{hierarchyVisualisationController.errorIntentionOrSectionNumber}" value="#{msgs.mapMustContainSectionsAndIntentions}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorIsolatedExclusiveSection}" value="#{msgs.isolatedExclusiveSection}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorIsolatedIntention}" value="#{msgs.isolatedIntention}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorMaxIterationNumberMissing}" value="#{msgs.maxIterationNumberMissing}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorStartOrStopIntentionMissing}" value="#{msgs.mapMustContainStartAndStopIntentions}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorStartIntention}" value="#{msgs.startIntentionMustBeSource}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorStopIntention}" value="#{msgs.stopIntentionMustBeTarget}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorMissingIntention}" value="#{msgs.missingIntentionUsedInSection}" />
						</p:outputPanel>
					</h:form>
					<p:panel closable="false" header="#{msgs.intentions}" rendered="#{null != hierarchyVisualisationController.selectedNode and hierarchyVisualisationController.selectedNodeMap and not hierarchyVisualisationController.actionExistingFromCurrentMap}" toggleable="true" toggleSpeed="300">
						<h:form id="intentionForm">
							<h:panelGrid columns="3">
								<h:outputText value="#{msgs.name}*: "/>
								<p:inputText id="inputIntentionName" required="true" value="#{hierarchyVisualisationController.intentionToCollect.label}"/>
								<p:commandButton action="#{hierarchyVisualisationController.initIntentionToCollect}" image="ui-icon ui-icon-plus" update="intentionsToAdd inputIntentionName sectionForm:inputSectionSourceIntention sectionForm:inputSectionTargetIntention" value="#{msgs.add}">
									<p:collector addTo="#{hierarchyVisualisationController.intentionsToAdd}" value="#{hierarchyVisualisationController.intentionToCollect}" />
								</p:commandButton>
							</h:panelGrid>
							<p:outputPanel id="intentionsToAdd">
								<p:dataTable emptyMessage="#{msgs.emptyDataTableMessage}" paginator="false" value="#{hierarchyVisualisationController.intentionsToAdd}" var="intention">
									<p:column styleClass="center">
										<p:commandButton image="ui-icon ui-icon-minus" process="@this" update="intentionForm:intentionsToAdd sectionForm:inputSectionSourceIntention sectionForm:inputSectionTargetIntention">
											<p:collector removeFrom="#{hierarchyVisualisationController.intentionsToAdd}" value="#{intention}" />
										</p:commandButton>
									</p:column>
									<p:column headerText="#{msgs.name}" sortBy="#{intention.label}" styleClass="center">
										<h:outputText value="#{intention.label}"/>
									</p:column>
								</p:dataTable>
							</p:outputPanel>
						</h:form>
					</p:panel>
					<p:panel closable="false" collapsed="true" header="#{msgs.sections}" rendered="#{null != hierarchyVisualisationController.selectedNode and hierarchyVisualisationController.selectedNodeMap and not hierarchyVisualisationController.actionExistingFromCurrentMap}" toggleable="true" toggleSpeed="300">
						<h:form id="sectionForm">
							<h:panelGrid cellpadding="5" columns="4" styleClass="left">
								<h:outputText value="#{msgs.sourceIntention}*: "/>
								<h:selectOneMenu id="inputSectionSourceIntention" required="true" value="#{hierarchyVisualisationController.sectionToCollect.sourceIntention}">
									<f:selectItems value="#{hierarchyVisualisationController.intentionsToAddAsSelectItem}" />
								</h:selectOneMenu>
								<h:outputText value="#{msgs.targetIntention}*: "/>
								<h:selectOneMenu id="inputSectionTargetIntention" required="true" value="#{hierarchyVisualisationController.sectionToCollect.targetIntention}">
									<f:selectItems value="#{hierarchyVisualisationController.intentionsToAddAsSelectItem}" />
								</h:selectOneMenu>
								<h:outputText value="#{msgs.strategyLabel}*: "/>
								<p:inputText id="inputSectionStrategyName" required="true" value="#{hierarchyVisualisationController.sectionToCollect.strategyLabel}"/>
								<h:outputText value="#{msgs.exclusive}*: "/>
								<h:selectBooleanCheckbox id="inputSectionExclusive" value="#{hierarchyVisualisationController.sectionToCollect.exclusive}"/>
								<h:outputText value="#{msgs.maxIterationNumber}*: "/>
								<p:inputText id="inputSectionMaxIterationNumber" value="#{hierarchyVisualisationController.sectionToCollect.maxIterationNumber}"/>
								<p:commandButton action="#{hierarchyVisualisationController.initSectionToCollect}" image="ui-icon ui-icon-plus" update="sectionForm sectionsToAdd" value="#{msgs.add}">
									<p:collector addTo="#{hierarchyVisualisationController.sectionsToAdd}" value="#{hierarchyVisualisationController.sectionToCollect}" />
								</p:commandButton>
								<h:panelGroup />
							</h:panelGrid>
							<p:outputPanel id="sectionsToAdd">
								<p:dataTable emptyMessage="#{msgs.emptyDataTableMessage}" paginator="false" value="#{hierarchyVisualisationController.sectionsToAdd}" var="section">
									<p:column styleClass="center">
										<p:commandButton image="ui-icon ui-icon-minus" process="@this" update="sectionForm:sectionsToAdd">
											<p:collector removeFrom="#{hierarchyVisualisationController.sectionsToAdd}" value="#{section}" />
										</p:commandButton>
									</p:column>
									<p:column headerText="#{msgs.sourceIntention}" sortBy="#{section.sourceIntention}" styleClass="center">
										<h:outputText value="#{section.sourceIntention}"/>
									</p:column>
									<p:column headerText="#{msgs.targetIntention}" sortBy="#{section.targetIntention}" styleClass="center">
										<h:outputText value="#{section.targetIntention}"/>
									</p:column>
									<p:column headerText="#{msgs.strategyLabel}" sortBy="#{section.strategyLabel}" styleClass="center">
										<h:outputText value="#{section.strategyLabel}"/>
									</p:column>
									<p:column headerText="#{msgs.maxIterationNumber}" sortBy="#{section.maxIterationNumber}" styleClass="center">
										<h:outputText value="#{section.maxIterationNumber}"/>
									</p:column>
									<p:column headerText="#{msgs.exclusive}" sortBy="#{section.exclusive}" styleClass="center">
										<h:selectBooleanCheckbox disabled="true" value="#{section.exclusive}"/>
									</p:column>
								</p:dataTable>
							</p:outputPanel>
						</h:form>
					</p:panel>
					<p:outputPanel layout="block" rendered="#{null != hierarchyVisualisationController.selectedNode and hierarchyVisualisationController.selectedNodeMap  and not hierarchyVisualisationController.actionExistingFromCurrentMap}" styleClass="buttonContainer center">
						<h:form id="buttonForm">
							<p:commandButton actionListener="#{hierarchyVisualisationController.onFinalizeMap}" image="ui-icon ui-icon-circle-plus" process="@this" update="errorForm hierarchyTreeForm:hierarchyTree visualizationUnit" value="#{msgs.toFinalizeMap}" />
						</h:form>
					</p:outputPanel>
					
					<!-- Map created -->
					<p:panel closable="false" collapsed="false" header="#{msgs.graphic}" rendered="#{null != hierarchyVisualisationController.selectedNode and hierarchyVisualisationController.selectedNodeMap and hierarchyVisualisationController.actionExistingFromCurrentMap}" toggleable="true" toggleSpeed="300">
						<h:form id="mapGraphicForm">
							<p:commandLink oncomplete="dialogMapDiagramFullScreen.show()" process="@this" type="submit" update="dialogMapDiagramFullScreenForm:inputAlgorithm dialogMapDiagramFullScreenForm:fullMapImage">
								<p:graphicImage alt="#{msgs.clickToOpenFullScreenMode}" styleClass="diagramMiniImage" value="#{hierarchyVisualisationController.mapDiagram}" title="#{msgs.clickToOpenFullScreenMode}">
									<f:param name="timestamp" value="#{sessionController.currentTimestamp}"/>
								</p:graphicImage>
							</p:commandLink>
						</h:form>
					</p:panel>
					<p:panel closable="false" collapsed="true" header="#{msgs.mapComponents}" rendered="#{null != hierarchyVisualisationController.selectedNode and hierarchyVisualisationController.selectedNodeMap and hierarchyVisualisationController.actionExistingFromCurrentMap}" toggleable="true" toggleSpeed="300">
						<h:panelGrid columns="1" styleClass="center container width100">
							<h:form id="intentionsForm">
								<p:dataTable currentPageReportTemplate="{currentPage} #{msgs.of} {totalPages}" emptyMessage="#{msgs.emptyDataTableMessage}" id="intentionsTable" paginator="true" paginatorAlwaysVisible="false" paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport}{PageLinks}{NextPageLink} {LastPageLink}" rows="5" rowsPerPageTemplate="5,10,20,50" selection="#{hierarchyVisualisationController.selectedIntentions}" value="#{hierarchyVisualisationController.intentions}" var="intention">
									<p:column selectionMode="multiple" />
									<p:column headerText="#{msgs.name}" sortBy="#{intention.label}" styleClass="center">
										<h:outputText value="#{intention.label}" />
									</p:column>
								</p:dataTable>
								<p:outputPanel layout="block" styleClass="buttonContainer center">
									<p:commandButton image="ui-icon ui-icon-minus" process="@this" value="#{msgs.delete}" />
								</p:outputPanel>
							</h:form>
							<h:form id="itemsForm">
								<p:dataTable currentPageReportTemplate="{currentPage} #{msgs.of} {totalPages}" emptyMessage="#{msgs.emptyDataTableMessage}" id="itemsTable" paginator="true" paginatorAlwaysVisible="false" paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport}{PageLinks}{NextPageLink} {LastPageLink}" rows="5" rowsPerPageTemplate="5,10,20,50" selection="#{hierarchyVisualisationController.selectedItems}" value="#{hierarchyVisualisationController.items}" var="item">
									<p:column selectionMode="multiple" />
									<p:column headerText="#{msgs.source}" sortBy="#{item.sourceIntentionLabel}" styleClass="center">
										<h:outputText value="#{item.sourceIntentionLabel}"/>
									</p:column>
									<p:column headerText="#{msgs.target}" sortBy="#{item.targetIntentionLabel}" styleClass="center">
										<h:outputText value="#{item.targetIntentionLabel}"/>
									</p:column>
									<p:column headerText="#{msgs.label}" sortBy="#{item.label}" styleClass="center">
										<h:outputText value="#{item.label}"/>
									</p:column>
									<p:column headerText="#{msgs.maxIterationNumber}" sortBy="#{item.maxIterationNumber}" styleClass="center">
										<h:outputText value="#{item.maxIterationNumber}"/>
									</p:column>
									<p:column headerText="#{msgs.exclusive}" sortBy="#{item.exclusive}" styleClass="center">
										<h:selectBooleanCheckbox disabled="true" value="#{item.exclusive}"/>
									</p:column>
									<p:column headerText="#{msgs.refined}" styleClass="center">
										<h:selectBooleanCheckbox disabled="true" value="#{item.refined}"/>
									</p:column>
									<p:column headerText="#{msgs.operationalized}" styleClass="center">
										<h:selectBooleanCheckbox disabled="true" value="#{item.operationalized}"/>
									</p:column>
								</p:dataTable>
								<p:outputPanel layout="block" styleClass="buttonContainer center">
									<p:commandButton image="ui-icon ui-icon-minus" process="@this" value="#{msgs.delete}" />
								</p:outputPanel>
							</h:form>
						</h:panelGrid>
					</p:panel>
					
					<!-- Item -->
					<h:outputText rendered="#{null != hierarchyVisualisationController.selectedNode and hierarchyVisualisationController.selectedNodeItem}" value="#{msgs.item}: #{hierarchyVisualisationController.selectedNode.data.label}"/>
					<p:outputPanel layout="block" rendered="#{null != hierarchyVisualisationController.selectedNode and hierarchyVisualisationController.selectedNodeItem and (sessionController.sessionUser.responsable or sessionController.sessionUser.administrator)}" styleClass="buttonContainer center">
						<h:form id="itemButtonForm">
							<p:commandButton actionListener="#{hierarchyVisualisationController.onRefineItem}" image="ui-icon ui-icon-arrowreturnthick-1-e" process="@this" update="hierarchyTreeForm:hierarchyTree visualizationUnit" value="#{msgs.refine}" />
							<p:commandButton actionListener="#{hierarchyVisualisationController.onOperationalizeItem}" image="ui-icon ui-icon-wrench" process="@this" update="hierarchyTreeForm:hierarchyTree visualizationUnit" value="#{msgs.operationalize}" />
						</h:form>
					</p:outputPanel>
					
					<!-- Procedural diagram to create -->
					<h:form id="proceduralErrorForm" rendered="#{null != hierarchyVisualisationController.selectedNode and hierarchyVisualisationController.selectedNodeProceduralDiagram  and not hierarchyVisualisationController.elementExistingFromCurrentDiagram}" styleClass="marginLogin">
						<p:outputPanel layout="block" rendered="#{hierarchyVisualisationController.errorElementOrTransitionNumber or hierarchyVisualisationController.errorIsolatedElement or hierarchyVisualisationController.errorMissingElement or hierarchyVisualisationController.errorMissingStartOrStopElement or hierarchyVisualisationController.errorOptionMissingAfterChoice or hierarchyVisualisationController.errorSourceEqualsTarget or hierarchyVisualisationController.errorTransitionNumberOnChoice or hierarchyVisualisationController.errorTransitionNumberOnJoin or hierarchyVisualisationController.errorStartElement or hierarchyVisualisationController.errorStopElement or hierarchyVisualisationController.errorMultipleTransitions or hierarchyVisualisationController.errorMultipleSources}" styleClass="errorMessage">
							<h:outputText rendered="#{hierarchyVisualisationController.errorElementOrTransitionNumber}" value="#{msgs.diagramMustContainElementsAndTransitions}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorIsolatedElement}" value="#{msgs.isolatedElement}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorMissingElement}" value="#{msgs.missingElementUsedInTransition}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorMissingStartOrStopElement}" value="#{msgs.diagramMustContainStartAndStopElements}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorMultipleSources}" value="#{msgs.multipleSources}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorMultipleTransitions}" value="#{msgs.multipleTransitionsBetweenElements}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorOptionMissingAfterChoice}" value="#{msgs.optionMissingOnTransitionAfterChoice}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorSourceEqualsTarget}" value="#{msgs.transitionCantHaveSourceEqualsTarget}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorStartElement}" value="#{msgs.startElementMustBeSource}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorStopElement}" value="#{msgs.stopElementsMustBeTarget}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorTransitionNumberOnChoice}" value="#{msgs.choicePointMustHaveALeastTwoTransitions}" />
							<h:outputText rendered="#{hierarchyVisualisationController.errorTransitionNumberOnJoin}" value="#{msgs.jointPointMustHaveALeastTwoTransitions}" />
						</p:outputPanel>
					</h:form>
					<p:panel closable="false" header="#{msgs.elements}" rendered="#{null != hierarchyVisualisationController.selectedNode and hierarchyVisualisationController.selectedNodeProceduralDiagram  and not hierarchyVisualisationController.elementExistingFromCurrentDiagram}" toggleable="true" toggleSpeed="300">
						<h:form id="elementsToAddForm">
							<h:panelGrid cellpadding="5" columns="5" styleClass="left">
								<h:outputText value="#{msgs.name}"/>
								<p:inputText id="inputElementName" required="true" value="#{hierarchyVisualisationController.elementToCollect.label}" />
								<h:outputText value="#{msgs.type}"/>
								<h:selectOneMenu id="inputElementType" required="true" value="#{hierarchyVisualisationController.elementToCollect.type}">
									<f:selectItems value="#{hierarchyVisualisationController.elementToAddTypesAsSelectItem}" />
								</h:selectOneMenu>
								<p:commandButton action="#{hierarchyVisualisationController.initElementToCreate}" image="ui-icon ui-icon-plus" update="elementsToAddForm:inputElementName elementsToAddForm:inputElementType transitionsToAddForm:inputTransitionSource transitionsToAddForm:inputTransitionTarget elementsToAdd" value="#{msgs.add}">
									<p:collector addTo="#{hierarchyVisualisationController.elementsToAdd}" value="#{hierarchyVisualisationController.elementToCollect}" />
								</p:commandButton>
							</h:panelGrid>
							<p:outputPanel id="elementsToAdd">
								<p:dataTable emptyMessage="#{msgs.emptyDataTableMessage}" paginator="false" value="#{hierarchyVisualisationController.elementsToAdd}" var="element">
									<p:column styleClass="center">
										<p:commandButton image="ui-icon ui-icon-minus" process="@this" update="elementsToAddForm:elementsToAdd transitionsToAddForm:inputTransitionSource transitionsToAddForm:inputTransitionTarget">
											<p:collector removeFrom="#{hierarchyVisualisationController.elementsToAdd}" value="#{element}" />
										</p:commandButton>
									</p:column>
									<p:column headerText="#{msgs.name}" sortBy="#{element.label}" styleClass="center">
										<h:outputText value="#{element.label}"/>
									</p:column>
									<p:column headerText="#{msgs.type}" sortBy="#{element.type}" styleClass="center">
										<h:outputText value="#{element.type}" />
									</p:column>
								</p:dataTable>
							</p:outputPanel>
						</h:form>
					</p:panel>
					<p:panel closable="false" collapsed="true" header="#{msgs.transitions}" rendered="#{null != hierarchyVisualisationController.selectedNode and hierarchyVisualisationController.selectedNodeProceduralDiagram  and not hierarchyVisualisationController.elementExistingFromCurrentDiagram}" toggleable="true" toggleSpeed="300">
						<h:form id="transitionsToAddForm">
							<h:panelGrid cellpadding="5" columns="4" styleClass="left">
								<h:outputText value="#{msgs.sourceElement}" />
								<h:selectOneMenu id="inputTransitionSource" required="true" value="#{hierarchyVisualisationController.transitionToCollect.source}">
									<f:selectItems value="#{hierarchyVisualisationController.elementsToAddAsSelectItem}"/>
								</h:selectOneMenu>
								<h:outputText value="#{msgs.targetElement}" />
								<h:selectOneMenu id="inputTransitionTarget" required="true" value="#{hierarchyVisualisationController.transitionToCollect.target}">
									<f:selectItems value="#{hierarchyVisualisationController.elementsToAddAsSelectItem}"/>
								</h:selectOneMenu>
								<h:outputText value="#{msgs.label}" />
								<p:inputText id="inputTransitionName" value="#{hierarchyVisualisationController.transitionToCollect.label}"/>
								<p:commandButton action="#{hierarchyVisualisationController.initTransitionToCollect}" image="ui-icon ui-icon-plus" update="transitionsToAddForm:inputTransitionName transitionsToAddForm:inputTransitionSource transitionsToAddForm:inputTransitionTarget transitionsToAddForm:transitionsToAdd" value="#{msgs.add}">
									<p:collector addTo="#{hierarchyVisualisationController.transitionsToAdd}" value="#{hierarchyVisualisationController.transitionToCollect}" />
								</p:commandButton>
								<h:panelGroup />
							</h:panelGrid>
							<p:outputPanel id="transitionsToAdd">
								<p:dataTable emptyMessage="#{msgs.emptyDataTableMessage}" paginator="false" value="#{hierarchyVisualisationController.transitionsToAdd}" var="transition">
									<p:column styleClass="center">
										<p:commandButton image="ui-icon ui-icon-minus" process="@this" update="transitionsToAddForm:transitionsToAdd">
											<p:collector removeFrom="#{hierarchyVisualisationController.transitionsToAdd}" value="#{transition}" />
										</p:commandButton>
									</p:column>
									<p:column headerText="#{msgs.sourceElement}" sortBy="#{transition.source}" styleClass="center">
										<h:outputText value="#{transition.source}"/>
									</p:column>
									<p:column headerText="#{msgs.targetElement}" sortBy="#{transition.target}" styleClass="center">
										<h:outputText value="#{transition.target}"/>
									</p:column>
									<p:column headerText="#{msgs.label}" sortBy="#{transition.label}" styleClass="center">
										<h:outputText value="#{transition.label}"/>
									</p:column>
								</p:dataTable>
							</p:outputPanel>
						</h:form>
					</p:panel>
					<p:outputPanel layout="block" rendered="#{null != hierarchyVisualisationController.selectedNode and hierarchyVisualisationController.selectedNodeProceduralDiagram  and not hierarchyVisualisationController.elementExistingFromCurrentDiagram}" styleClass="buttonContainer center">
						<h:form id="proceduralDiagrambuttonForm">
							<p:commandButton actionListener="#{hierarchyVisualisationController.onFinalizeProceduralDiagram}" image="ui-icon ui-icon-circle-plus" process="@this" update="proceduralErrorForm hierarchyTreeForm:hierarchyTree visualizationUnit" value="#{msgs.toFinalizeDiagram}" />
						</h:form>
					</p:outputPanel>
					
					<!-- Procedural diagram created -->
					<p:panel closable="false" header="#{msgs.graphic}" rendered="#{null != hierarchyVisualisationController.selectedNode and hierarchyVisualisationController.selectedNodeProceduralDiagram  and hierarchyVisualisationController.elementExistingFromCurrentDiagram}" toggleable="true" toggleSpeed="300">
						<h:form id="proceduralGraphicForm">
							<p:commandLink oncomplete="dialogProceduralDiagramFullScreen.show()" process="@this" type="submit" update="dialogProceduralDiagramFullScreenForm:inputAlgorithm dialogProceduralDiagramFullScreenForm:fullProceduralImage">
								<p:graphicImage alt="#{msgs.clickToOpenFullScreenMode}" styleClass="diagramMiniImage" value="#{hierarchyVisualisationController.proceduralDiagram}" title="#{msgs.clickToOpenFullScreenMode}">
									<f:param name="timestamp" value="#{sessionController.currentTimestamp}"/>
								</p:graphicImage>
							</p:commandLink>
						</h:form>
					</p:panel>
					<p:panel closable="false" collapsed="true" header="#{msgs.diagramComponents}" rendered="#{null != hierarchyVisualisationController.selectedNode and hierarchyVisualisationController.selectedNodeProceduralDiagram  and hierarchyVisualisationController.elementExistingFromCurrentDiagram}" toggleable="true" toggleSpeed="300">
						<h:panelGrid columns="1" styleClass="center container width100">
							<h:form id="elementsForm">
								<p:dataTable currentPageReportTemplate="{currentPage} #{msgs.of} {totalPages}" emptyMessage="#{msgs.emptyDataTableMessage}" id="elementsTable" paginator="true" paginatorAlwaysVisible="false" paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport}{PageLinks}{NextPageLink} {LastPageLink}" rows="5" rowsPerPageTemplate="5,10,20,50" selection="#{hierarchyVisualisationController.selectedElements}" value="#{hierarchyVisualisationController.elements}" var="element">
									<p:column selectionMode="multiple" />
									<p:column headerText="#{msgs.name}" sortBy="#{element.label}" styleClass="center">
										<h:outputText value="#{element.label}" />
									</p:column>
									<p:column headerText="#{msgs.type}" styleClass="center">
										<h:outputText rendered="#{0 != element.activityId}" value="#{msgs.activity}"/>
										<h:outputText rendered="#{0 == element.activityId}" value="#{element.pointTypeString}"/>
									</p:column>
								</p:dataTable>
								<p:outputPanel layout="block" styleClass="buttonContainer center">
									<p:commandButton image="ui-icon ui-icon-minus" process="@this" value="#{msgs.delete}" />
								</p:outputPanel>
							</h:form>
							<h:form id="transitionsForm">
								<p:dataTable currentPageReportTemplate="{currentPage} #{msgs.of} {totalPages}" emptyMessage="#{msgs.emptyDataTableMessage}" id="transitionsTable" paginator="true" paginatorAlwaysVisible="false" paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport}{PageLinks}{NextPageLink} {LastPageLink}" rows="5" rowsPerPageTemplate="5,10,20,50" selection="#{hierarchyVisualisationController.selectedTransitions}" value="#{hierarchyVisualisationController.transitions}" var="transition">
									<p:column selectionMode="multiple" />
									<p:column headerText="#{msgs.sourceElement}" sortBy="#{transition.sourceElementLabel}" styleClass="center">
										<h:outputText value="#{transition.sourceElementLabel}"/>
									</p:column>
									<p:column headerText="#{msgs.targetElement}" sortBy="#{transition.targetElementLabel}" styleClass="center">
										<h:outputText value="#{transition.targetElementLabel}"/>
									</p:column>
									<p:column headerText="#{msgs.label}" sortBy="#{transition.label}" styleClass="center">
										<h:outputText value="#{transition.label}"/>
									</p:column>
								</p:dataTable>
								<p:outputPanel layout="block" styleClass="buttonContainer center">
									<p:commandButton image="ui-icon ui-icon-minus" process="@this" value="#{msgs.delete}" />
								</p:outputPanel>
							</h:form>
						</h:panelGrid>
					</p:panel>
					<p:panel closable="false" collapsed="true" header="#{msgs.activitiesToDocument}" rendered="#{null != hierarchyVisualisationController.selectedNode and hierarchyVisualisationController.selectedNodeProceduralDiagram  and hierarchyVisualisationController.elementExistingFromCurrentDiagram}" toggleable="true" toggleSpeed="300">
						<h:form id="activitiesToDescribeForm">
							<p:dataTable currentPageReportTemplate="{currentPage} #{msgs.of} {totalPages}" emptyMessage="#{msgs.emptyDataTableMessage}" id="activitiesTable" paginator="true" paginatorAlwaysVisible="false" paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport}{PageLinks}{NextPageLink} {LastPageLink}" rows="5" rowsPerPageTemplate="5,10,20,50" value="#{hierarchyVisualisationController.activitiesToDescribe}" var="activity">
								<p:column headerText="#{msgs.name}" sortBy="#{activity.label}" styleClass="center">
									<h:outputText value="#{activity.label}" />
								</p:column>
								<p:column headerText="#{msgs.actions}" styleClass="center">
									<p:commandButton action="#{hierarchyVisualisationController.onActivityDocumentation}" ajax="true" alt="#{msgs.document}" image="ui-icon ui-icon-pencil" process="@this" title="#{msgs.document}">
										<f:setPropertyActionListener target="#{activityDocumentationController.currentActivityToDocument}" value="#{activity}" />
									</p:commandButton>
								</p:column>
							</p:dataTable>
						</h:form>
					</p:panel>
					<p:panel closable="false" collapsed="true" header="#{msgs.variants}" rendered="#{(null != hierarchyVisualisationController.selectedNode and hierarchyVisualisationController.selectedNodeProceduralDiagram  and hierarchyVisualisationController.elementExistingFromCurrentDiagram) and hierarchyVisualisationController.variantsExistingFromCurrentDiagram}" toggleable="true" toggleSpeed="300">
						<h:form id="variantsForm">
							<p:dataTable currentPageReportTemplate="{currentPage} #{msgs.of} {totalPages}" emptyMessage="#{msgs.emptyDataTableMessage}" id="variantsTable" paginator="true" paginatorAlwaysVisible="false" paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport}{PageLinks}{NextPageLink} {LastPageLink}" rows="5" rowsPerPageTemplate="5,10,20,50" value="#{hierarchyVisualisationController.variants}" var="variant">
								<p:column styleClass="center">
									<p:graphicImage value="#{(variant.success)?'resources/images/successIcon.png':'resources/images/failureIcon.png'}" />
								</p:column>
								<p:column headerText="#{msgs.id}" sortBy="#{variant.variantId}" styleClass="center">
									<h:outputText value="#{variant.variantId}" />
								</p:column>
								<p:column headerText="#{msgs.label}" sortBy="#{variant.label}" styleClass="center">
									<p:inplace effect="slide" effectSpeed="fast" emptyLabel="#{msgs.clickHereToUpdateThisField}" widgetVar="labelInplace#{variant.variantId}">
										<p:inputText value="#{variant.label}" />
										<p:commandButton action="#{hierarchyVisualisationController.onVariantUpdate}" ajax="true" alt="#{msgs.updateValue}" image="ui-icon ui-icon-check" oncomplete="labelInplace#{variant.variantId}.hide()" process="@parent" title="#{msgs.updateValue}" update="@parent hierarchyTreeForm:hierarchyTree">
											<f:setPropertyActionListener target="#{hierarchyVisualisationController.currentEditingVariant}" value="#{variant}"/>
										</p:commandButton>
									</p:inplace>
								</p:column>
								<p:column headerText="#{msgs.quantitativeCriterion}" sortBy="#{variant.quantitativeCriterion}" styleClass="center">
									<p:inplace effect="slide" effectSpeed="fast" emptyLabel="#{msgs.clickHereToUpdateThisField}" widgetVar="criterionInplace#{variant.variantId}">
										<p:inputText value="#{variant.quantitativeCriterion}" />
										<p:commandButton action="#{hierarchyVisualisationController.onVariantUpdate}" ajax="true" alt="#{msgs.updateValue}" image="ui-icon ui-icon-image" oncomplete="criterionInplace#{variant.variantId}.hide()" process="@parent" title="#{msgs.updateValue}" update="@parent">
											<f:setPropertyActionListener target="#{hierarchyVisualisationController.currentEditingVariant}" value="#{variant}"/>
										</p:commandButton>
									</p:inplace>
								</p:column>
							</p:dataTable>
						</h:form>
					</p:panel>
					<p:outputPanel layout="block" rendered="#{(null != hierarchyVisualisationController.selectedNode and hierarchyVisualisationController.selectedNodeProceduralDiagram  and hierarchyVisualisationController.elementExistingFromCurrentDiagram) and (sessionController.sessionUser.responsable or sessionController.sessionUser.administrator) and (not hierarchyVisualisationController.variantsExistingFromCurrentDiagram)}" styleClass="buttonContainer center">
						<h:form id="variantsGenerationForm">
							<p:commandButton actionListener="#{hierarchyVisualisationController.onGenerateVariants}" image="ui-icon ui-icon-gear" process="@this" update="hierarchyTreeForm:hierarchyTree visualizationUnit" value="#{msgs.generateVariants}" />
						</h:form>
					</p:outputPanel>
					
					<!-- Variants -->
					
					<p:panel closable="false" header="#{msgs.graphic}" rendered="#{null != hierarchyVisualisationController.selectedNode and (hierarchyVisualisationController.selectedNodeFailureVariant or hierarchyVisualisationController.selectedNodeSuccessVariant)}" toggleable="true" toggleSpeed="300">
						<h:form id="variantGraphicForm">
							<p:commandLink oncomplete="dialogVariantDiagramFullScreen.show()" process="@this" type="submit" update="dialogVariantDiagramFullScreenForm:fullVariantImage dialogVariantDiagramFullScreenForm:inputAlgorithm">
								<p:graphicImage alt="#{msgs.clickToOpenFullScreenMode}" styleClass="diagramMiniImage" value="#{hierarchyVisualisationController.variantDiagram}" title="#{msgs.clickToOpenFullScreenMode}">
									<f:param name="timestamp" value="#{sessionController.currentTimestamp}"/>
								</p:graphicImage>
							</p:commandLink>
						</h:form>
					</p:panel>
					<p:panel closable="false" collapsed="true" header="#{msgs.variantComponents}" rendered="#{null != hierarchyVisualisationController.selectedNode and (hierarchyVisualisationController.selectedNodeFailureVariant or hierarchyVisualisationController.selectedNodeSuccessVariant)}" toggleable="true" toggleSpeed="300">
						<h:form id="variantsComponentsForm">
							<h:panelGrid columns="1" styleClass="center container width100">
								<p:dataTable currentPageReportTemplate="{currentPage} #{msgs.of} {totalPages}" emptyMessage="#{msgs.emptyDataTableMessage}" id="variantsElementsTable" paginator="true" paginatorAlwaysVisible="false" paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport}{PageLinks}{NextPageLink} {LastPageLink}" rows="5" rowsPerPageTemplate="5,10,20,50" selection="#{hierarchyVisualisationController.selectedVariantsElements}" value="#{hierarchyVisualisationController.variantsElements}" var="variantElement">
									<p:column selectionMode="multiple" />
									<p:column headerText="#{msgs.name}" sortBy="#{variantElement.label}" styleClass="center">
										<h:outputText value="#{variantElement.label}" />
									</p:column>
									<p:column headerText="#{msgs.type}" styleClass="center">
										<h:outputText rendered="#{0 != variantElement.activityId}" value="#{msgs.activity}"/>
										<h:outputText rendered="#{0 == variantElement.activityId}" value="#{variantElement.pointTypeString}"/>
									</p:column>
								</p:dataTable>
								<p:outputPanel layout="block" styleClass="buttonContainer center">
									<p:commandButton image="ui-icon ui-icon-minus" process="@this" value="#{msgs.delete}" />
								</p:outputPanel>
								<p:dataTable currentPageReportTemplate="{currentPage} #{msgs.of} {totalPages}" emptyMessage="#{msgs.emptyDataTableMessage}" id="variantsTransitionsTable" paginator="true" paginatorAlwaysVisible="false" paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport}{PageLinks}{NextPageLink} {LastPageLink}" rows="5" rowsPerPageTemplate="5,10,20,50" selection="#{hierarchyVisualisationController.selectedVariantsTransitions}" value="#{hierarchyVisualisationController.variantsTransitions}" var="variantTransition">
									<p:column selectionMode="multiple" />
									<p:column headerText="#{msgs.sourceElement}" sortBy="#{variantTransition.sourceElementLabel}" styleClass="center">
										<h:outputText value="#{variantTransition.sourceElementLabel}"/>
									</p:column>
									<p:column headerText="#{msgs.targetElement}" sortBy="#{variantTransition.targetElementLabel}" styleClass="center">
										<h:outputText value="#{variantTransition.targetElementLabel}"/>
									</p:column>
									<p:column headerText="#{msgs.label}" sortBy="#{variantTransition.label}" styleClass="center">
										<h:outputText value="#{variantTransition.label}"/>
									</p:column>
								</p:dataTable>
								<p:outputPanel layout="block" styleClass="buttonContainer center">
									<p:commandButton image="ui-icon ui-icon-minus" process="@this" value="#{msgs.delete}" />
								</p:outputPanel>
							</h:panelGrid>
						</h:form>
					</p:panel>
				</p:outputPanel>
				<p:outputPanel layout="block" rendered="#{not sessionController.sessionUser.responsable and not sessionController.sessionUser.administrator and null != hierarchyVisualisationController.selectedNode and ((hierarchyVisualisationController.selectedNodeMap and not hierarchyVisualisationController.actionExistingFromCurrentMap) or (hierarchyVisualisationController.selectedNodeProceduralDiagram and not hierarchyVisualisationController.elementExistingFromCurrentDiagram))}" styleClass="warnMessage">
					<h:outputText value="#{msgs.notRightsToModifyThisHierarchy}" />
				</p:outputPanel>
			</p:layoutUnit>
		</p:layout>
		<ui:include src="dialog/dialogMapDiagramFullScreenMode.xhtml" />
		<ui:include src="dialog/dialogProceduralDiagramFullScreenMode.xhtml" />
		<ui:include src="dialog/dialogVariantDiagramFullScreenMode.xhtml" />
	</ui:define>
</ui:composition>